<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link rel="stylesheet" href="../../../static/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="../../../static/css/public.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form" lay-filter="formTest" id="form">
		<div class="layui-card">
			<div class="layui-card-header">网站设置</div>
			<div class="layui-card-body" pad15>

				<div class="layui-form-item layui-row layui-col-xs12">
					<div class="layui-input-block" style="margin-left: 130px;">
						<button type="button" class="layui-btn layui-btn-sm" lay-submit="" lay-filter="submit">提交</button>
					</div>
				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="../../../static/js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../../static/layui/layui.js"></script>
	<script type="text/javascript" src="../../../static/js/index.js"></script>
	<script type="text/javascript" src="../../../static/custom/js/common.js"></script>
	<script type="text/javascript">
		layui.use([ 'form', 'laydate', 'layer' ], function() {
			var form = layui.form;
			var laydate = layui.laydate;
			var layer = parent.layer === undefined ? layui.layer : top.layer, $ = layui.jquery;
			var listApi = "../../../system/attribute/list";
			var updateApi = "../../../system/attribute/update";
			var updateMethod = "put";
			var url = updateApi;
			var method = updateMethod;
			function sysattrHtml(index, data) {
				if (!data) {
					data = {
						dkey : '',
						dvalue : ''
					}
				}
				if (!index) {
					index = 0;
				}
				var str = '';
				str += '		<div class="layui-form-item">                                                    ';
				str += '			<label class="layui-form-label"  style="text-align:center;width:100px">' + data.name + '</label>                                 ';
				str += '			<div class="layui-input-block">                                                  ';
				str += '				<input type="text" class="layui-input dvalue" name="dvalue"  lay-verify="required"  style="width:90%" value="' + data.dvalue + '">          ';
				str += '				<input type="hidden" class="id" name="id" value="' + data.id + '">          ';
				str += '			</div>                                                                           ';
				str += '        </div>                                                                             ';
				return str;
			}

			loadAjax( listApi, "get", null, function(response) {
				baseCallBack(response, function(response) {
					for ( var i in response.data) {
						$(".layui-card-body").prepend(sysattrHtml(i, response.data[i]));
					}
				});
			});

			form.on("submit(submit)", function(data) {
				loadAjax( url, method, $("#form").serialize(), function(response) {
					layer.msg(response.msg);
				});
				return false;
			})
		})
	</script>
</body>
</html>